widget: Improve gtk_cairo_should_draw_window()
authorBenjamin Otte <otte@redhat.com>
Thu, 21 Jan 2016 15:53:25 +0000 (16:53 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 22 Jan 2016 13:18:15 +0000 (14:18 +0100)
Check that non-native window are indeed children of the event window and
only then confirm that they should be drawn.

Fixes Glade thinking that it's okay to have the draw function do
different things depending on what window to draw. (This should really
be fixed in Glade.)

gtk/gtkwidget.c

index ba85df6a71b55e59149e7622bbbc5a19121f29af..2c9f776e8a96a1d8421f9a41803a351bdc672d3a 100644 (file)
@@ -6927,13 +6927,15 @@ gtk_cairo_should_draw_window (cairo_t *cr,
   g_return_val_if_fail (cr != NULL, FALSE);
   g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
 
-  if (!gdk_window_has_native (window))
+  event_window = gtk_cairo_get_event_window (cr);
+
+  if (event_window == NULL)
     return TRUE;
 
-  event_window = gtk_cairo_get_event_window (cr);
+  while (!gdk_window_has_native (window))
+    window = gdk_window_get_parent (window);
 
-  return event_window == NULL ||
-    event_window == window;
+  return event_window == window;
 }
 
 void